home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / New System Software Extensions / OpenDoc A6 / OpenDoc Parts Framework / OPF / Examples / Clock / Include / ClockPar.h < prev    next >
Encoding:
Text File  |  1994-04-21  |  5.7 KB  |  189 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                ClockPar.h
  4. //    Release Version:    $ 1.0d1 $
  5. //
  6. //    Author:                Lonnie Millett
  7. //    Creation Date:        3/28/94
  8. //
  9. //    Copyright:    © 1993, 1994 by Apple Computer, Inc., all rights reserved.
  10. //
  11. //========================================================================================
  12.  
  13. #ifndef CLOCKPAR_H
  14. #define CLOCKPAR_H
  15.  
  16. #ifndef CCLOCKDEF_H
  17. #include "CClockDef.h"
  18. #endif
  19.  
  20. #ifndef FWPART_H
  21. #include <FWPart.h>
  22. #endif
  23.  
  24. //==============================================================================
  25. // Classes defined in this interface
  26. //==============================================================================
  27.  
  28. class CClockPart;
  29.  
  30. //==============================================================================
  31. // Classes used by this interface
  32. //==============================================================================
  33.  
  34. class FW_CPart;
  35. class XMPStorageUnit;
  36. class XMPSession;
  37. class XMPFrame;
  38. class XMPFocusSet;
  39.  
  40. //==============================================================================
  41. // Constants
  42. //==============================================================================
  43.  
  44. const XMPCommandID cClockType = 10000;
  45. const XMPCommandID cClockSoundsNone = 10001;
  46. const XMPCommandID cClockSoundsTick = 10002;
  47. const XMPCommandID cClockSoundsChime = 10003;
  48. const XMPCommandID cClockSoundsBoth = 10004;
  49. const XMPCommandID cClockPlayChimeSound = 10005;
  50.  
  51. const short kAnalogClock = 1;
  52. const short kDigitalClock = 2;
  53.  
  54. //==============================================================================
  55. // CClockPart
  56. //==============================================================================
  57.  
  58. class CClockPart : public FW_CPart
  59. {
  60.  
  61. public:
  62.     CClockPart();
  63.     virtual ~ CDECL CClockPart();
  64.  
  65.     virtual void Release();
  66.  
  67.     virtual void Initialize();
  68.     
  69.     virtual XMPValueType GetContentPropertyValueType() const; 
  70.     
  71.     unsigned long GetLastTime() const;
  72.     void SetLastTime(unsigned long lastTime);
  73.     
  74.     short GetClockType() const;
  75.     void SetClockType(short clockType);
  76.     
  77.     short GetClockSounds() const;
  78.     void SetClockSounds(short clockSounds);
  79.  
  80.     PicHandle GetBackgroundPICT() const;
  81.     void SetBackgroundPICT(PicHandle backgroundPICT);
  82.  
  83.     FW_PlatformHandle GetChimeSound() const;
  84.     void SetChimeSound(FW_PlatformHandle chimeSound);
  85.  
  86.     XMPTypeToken GetAudioFocusToken() const;
  87.     
  88.     virtual FW_CFrame* NewFrame(XMPFrame* xmpFrame, XMPTypeToken presentation);
  89.     virtual void AddDisplayFrame(XMPFrame* xmpFrame);
  90.     virtual void RemoveDisplayFrame(XMPFrame* xmpFrame);
  91.     
  92.     virtual FW_Boolean DoIdle();
  93.     virtual FW_Boolean DoMenuEvent(XMPMenuBar *menuBar, XMPCommandID commandID);
  94.     virtual void DoAdjustMenus(XMPMenuBar* menuBar);
  95.     
  96.     virtual void InternalizeContent(XMPStorageUnit* storageUnit);
  97.     virtual void ExternalizeContent(XMPStorageUnit* storageUnit);
  98.     
  99.     virtual FW_CSelection* NewSelection();
  100.     
  101.     void PlayTickSound();
  102.     void PlayChimeSound();
  103.     
  104. private:
  105.     unsigned long fLastTime;
  106.     short fClockType;
  107.     short fClockSounds;
  108.     FW_PlatformHandle fChimeSound;
  109.     FW_PlatformHandle fTickSound;
  110.     PicHandle fBackgroundPICT;
  111.     XMPTypeToken fAudioFocusToken;
  112.     XMPFocusSet* fAudioFocusSet;
  113.     XMPFrame* fAudioFocusFrame;
  114. };
  115.  
  116. //----------------------------------------------------------------------------------------
  117. // CClockPart::GetLastTime
  118. //----------------------------------------------------------------------------------------
  119. inline unsigned long CClockPart::GetLastTime() const
  120. {
  121.     return fLastTime;
  122. }
  123.  
  124. //----------------------------------------------------------------------------------------
  125. // CClockPart::SetLastTime
  126. //----------------------------------------------------------------------------------------
  127. inline void CClockPart::SetLastTime(unsigned long lastTime)
  128. {
  129.     fLastTime = lastTime;
  130. }
  131.  
  132. //----------------------------------------------------------------------------------------
  133. // CClockPart::GetClockType
  134. //----------------------------------------------------------------------------------------
  135. inline short CClockPart::GetClockType() const
  136. {
  137.     return fClockType;
  138. }
  139.  
  140. //----------------------------------------------------------------------------------------
  141. // CClockPart::SetClockType
  142. //----------------------------------------------------------------------------------------
  143. inline void CClockPart::SetClockType(short clockType)
  144. {
  145.     fClockType = clockType;
  146. }
  147.  
  148. //----------------------------------------------------------------------------------------
  149. // CClockPart::GetClockSounds
  150. //----------------------------------------------------------------------------------------
  151. inline short CClockPart::GetClockSounds() const
  152. {
  153.     return fClockSounds;
  154. }
  155.  
  156. //----------------------------------------------------------------------------------------
  157. // CClockPart::SetClockSounds
  158. //----------------------------------------------------------------------------------------
  159. inline void CClockPart::SetClockSounds(short clockSounds)
  160. {
  161.     fClockSounds = clockSounds;
  162. }
  163.  
  164. //----------------------------------------------------------------------------------------
  165. // CClockPart::GetAudioFocusToken
  166. //----------------------------------------------------------------------------------------
  167. inline XMPTypeToken CClockPart::GetAudioFocusToken() const
  168. {
  169.     return fAudioFocusToken;
  170. }
  171.  
  172. //----------------------------------------------------------------------------------------
  173. // CClockPart::GetChimeSound
  174. //----------------------------------------------------------------------------------------
  175. inline FW_PlatformHandle CClockPart::GetChimeSound() const
  176. {
  177.     return fChimeSound;
  178. }
  179.  
  180. //----------------------------------------------------------------------------------------
  181. // CClockPart::GetBackgroundPICT
  182. //----------------------------------------------------------------------------------------
  183. inline PicHandle CClockPart::GetBackgroundPICT() const
  184. {
  185.     return fBackgroundPICT;
  186. }
  187.  
  188. #endif
  189.